package com.yunsc.order.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunsc.order.dto.QueryRechargeOrderDTO;
import com.yunsc.order.entity.YunscRechargeOrderEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 会员充值订单表
 * 
 * @author adan
 * @email 2028038953@qq.com
 * @date 2024-04-22 11:35:51
 */
@Mapper
public interface YunscRechargeOrderDao extends BaseMapper<YunscRechargeOrderEntity> {

    /**
     * 分页查询充值订单
     *
     * @param objectPage 分页对象
     * @param param      查询参数
     * @param storeId
     * @return 充值订单分页数据
     */
    Page<YunscRechargeOrderEntity> selectRechargeOrder(
            Page<Object> objectPage,
            @Param("param") QueryRechargeOrderDTO param,
            @Param("startTime") Long startTime,
            @Param("endTime") Long endTime,
            @Param("storeId") Integer storeId);

    /**
     * 用户充值总额 (元)
     *
     * @param startInSeconds 开始时间seconds
     * @param endInSeconds 结束时间seconds
     * @param storeId        店铺ID
     * @return 用户充值总额 (元)
     */
    // @Select("SELECT SUM(pay_price) FROM yunsc_recharge_order WHERE store_id = #{storeId} and pay_status = 20")
    String selectRechargeTotal(@Param("startInSeconds") int startInSeconds, @Param("endInSeconds") int endInSeconds, @Param("storeId") Integer storeId);
}
